package com.example.evanproject.controller;

import com.example.evanproject.domain.PageView;
import com.example.evanproject.service.impl.PageViewServiceImpl;
import com.example.evanproject.util.AjaxResult;
import com.example.evanproject.util.DatesUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/page")
@CrossOrigin
public class PageViewController {
    @Autowired
    private PageViewServiceImpl pageViewService;

    @RequestMapping("addNum")
    public AjaxResult addPageView(PageView pageView){
        pageView.setCreateTime(DatesUtils.getTime());
       return AjaxResult.success(pageViewService.save(pageView));
    }
}
